home *** CD-ROM | disk | FTP | other *** search
- /****
- *
- * These are the routine required to handle the major dialog boxes.
- *
- ***/
-
- # include <types.h>
- # include <memory.h>
- # include <quickdraw.h>
- # include <toolutils.h>
- # include <windows.h>
- # include <controls.h>
- # include <dialogs.h>
- # include <textedit.h>
- # include <string.h>
- # include <resources.h>
- # include <fonts.h>
- # include <menus.h>
- # include <Events.h>
-
- # include <iac.h>
- # define PUBLIC extern
- # include <Editor.h>
-
-
- /**
- * Routine: about_box
- *
- * This handles the about box; the current name of this app is displayed
- * to make working with multiple copies easier. No other fancy effects
- * this time...
- */
-
- # define __SEG__ Main
- void about_box()
- {
- DialogPtr d_Ptr;
- short item_hit;
- Ptr curApNmP; /* LOW MEMORY GLOBAL! */
-
- curApNmP = (Ptr) 0x910;
- PARAMTEXT (curApNmP,"","",""); /* Pascal interface version */
- d_Ptr = GetNewDialog (ABOUT_DLOG, nil, (WindowPtr) -1);
- ModalDialog (nil, &item_hit);
- DisposDialog (d_Ptr);
- }
-
-
- /**
- * Routine: linkInfo_box()
- *
- * This routine displays a dialog box with information about each link
- * in the current document.
- */
-
- # define SCROLL_BAR_ITEM 3
- # define LIST_BOX 4
-
- # define __SEG__ Main
- void linkInfo_box()
-
- {
- short iac_code; /* result from IAC call */
- DialogPtr d_Ptr;
- short i, lines_vis; /* scratch */
- win_dataH the_data_H; /* data associated with a window */
- extentH the_extH; /* handle to extent block */
- exTable ext_recs; /* ptr to extent-array */
- TEHandle TextH; /* The TextEdit handle */
- ControlHandle scrollH; /* Scroll bar handle */
- String(16) ext_no; /* holds converted values */
- short i_type; /* for GetDItem */
- Handle i_hdnl;
- Rect i_box;
- char *msg;
- short e_cnt; /* count of active extents */
- info_tbl census_info; /* census info for every extent */
- Point mouse_loc;
- Boolean b;
-
- short item_hit = 0;
-
- /* get necessary handles, etc. set up */
- the_data_H = (win_dataH) GetWRefCon (myWindow);
- the_extH = (**the_data_H).the_extents;
-
- iac_code = iac_census(&e_cnt, &census_info); /* que pasa, driver? */
- if (e_cnt==0)
- {
- return;
- }
-
- /* set up text area */
- d_Ptr = GetNewDialog (ABOUT_LINKS, nil, (WindowPtr) -1);
- SetPort ((GrafPtr) d_Ptr);
- TextFont (monaco); /* mono-spaced for easy layout */
- TextSize (9);
- GetDItem (d_Ptr, LIST_BOX, &i_type, &i_hdnl, &i_box); /* text-area box */
- i_box.right += 1; /* overlap scroll bar properly */
- FrameRect (&i_box);
- InsetRect (&i_box, 2, 2); /* margin for drawing */
- TextH = TENew (&i_box, &i_box);
- lines_vis = (i_box.bottom - i_box.top) / 12; /* text lines visible */
-
- /* Highlight button */
- GetDItem (d_Ptr, ok, &i_type, &i_hdnl, &i_box); /* button */
- InsetRect (&i_box, -4, -4);
- PenSize (3, 3);
- FrameRoundRect (&i_box, 16, 16);
- PenNormal();
-
- /* set up scroll bar */
- scrollH = GetNewControl (ABOUT_LINKS, d_Ptr);
- if (e_cnt > lines_vis) /* enable control */
- {
- SetCtlMax (scrollH, e_cnt);
- }
-
- /* put in header */
- msg = "Ext# --Doc_ID-- Hat_check Edition\n\n";
- TEInsert (msg, (long) strlen(msg), TextH);
-
- /* do each extent in turn */
- for (i=0; i<e_cnt; i++)
- {
- sprintf(&ext_no, "%4d", i);
- TEInsert (&ext_no, 4L, TextH);
- sprintf(&ext_no, " $%8X", census_info.ext_entry[i].doc_ID);
- TEInsert (&ext_no, 10L, TextH);
- sprintf(&ext_no, "%9d", census_info.ext_entry[i].hat_check);
- TEInsert (&ext_no, 9L, TextH);
- sprintf(&ext_no, "%9d", census_info.ext_entry[i].ed_level);
- TEInsert (&ext_no, 9L, TextH);
- TEKey(0x0D, TextH); /* \n to end line */
- }
- TextFont(systemFont); /* so static text looks right */
- TextSize (12);
-
- /*
- * The normal modal dialog loop. You can't do anything except look at
- * the range of each extent.
- */
- while (item_hit != ok)
- {
- ModalDialog (nil, &item_hit);
- switch (item_hit)
- {
- case SCROLL_BAR_ITEM:
- GetMouse (&mouse_loc);
- GlobalToLocal (&mouse_loc);
- /* scrolling code here later */
- break;
-
- default:
- break;
- }
- }
-
- DisposeControl (scrollH); /* clean up after ourselves */
- DisposDialog (d_Ptr);
- SetPort(FrontWindow());
- }
-
-
- /**
- * Routine: killLink_box
- *
- * This is the user interface that allows a user to "cut" a hot link.
- */
-
- # define __SEG__ Main
- void killLink_box()
- {
- short item_hit;
-
- extern void kill_extent();
-
- if (ext_active)
- {
- item_hit = StopAlert (KILL_EXT, nil); /* Are you SURE? */
- if (item_hit == ok)
- {
- kill_extent();
- }
- }
- else
- {
- item_hit = StopAlert (NOT_IN_EXT, nil); /* not in any extent */
- }
- }
-